function la = cellstrIsMember(A, B, i)
  % la = 1 where the elements of cellstr array A are in cellstr array B, 0 where they are not
  % i is an optional parameter: if case matters, i=1 (the default), 
  %     0 for case-insensitive matching (which is much slower)
  %
  % Authors: David Goldsmith, Wash. State Dept. of Ecology, dgol461@ecy.wa.gov
  %          Jan Simon, 
  % Release date: 2011-08-24
  
    if nargin < 3
        i = 1;
    end
  
    la = false(size(A));
    if isempty(A) || isempty(B)
        la = ismember(A, B);
    elseif i
        for j=1:numel(A)
            la(j) = any(cell2mat(regexp(A{j}, B))); 
        end
    else
        for j=1:numel(A)
            la(j) = any(cell2mat(regexpi(A{j}, B))); 
        end
    end
  
end